package au.edu.swin.videoshop.bean;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

public class MediumType implements Serializable {
	private static final Map sMap = new HashMap();
	
	public static final MediumType TAPE = new MediumType("tape", "Tape", "/images/icons/medium_tape.png");
	public static final MediumType VCD = new MediumType("vcd", "VCD", "/images/icons/medium_vcd.png");
	public static final MediumType DVD = new MediumType("dvd", "DVD", "/images/icons/medium_dvd.jpg");
	public static final MediumType BLURAY = new MediumType("bluray", "Blu-ray", "/images/icons/medium_bluray.png");
	public static final MediumType HDDVD = new MediumType("hddvd", "HD DVD", "/images/icons/medium_hddvd.png");
	
	private String mName;
	private String mDescription;
	private String mIconUrl;
	
	private MediumType(String name, String description, String iconUrl) {
		mName = name;
		mDescription = description;
		mIconUrl = iconUrl;
		
		sMap.put(name, this);
	}
	
	/**
	 * @return the name
	 */
	public String getName() {
		return mName;
	}
	
	/**
	 * @return the description
	 */
	public String getDescription() {
		return mDescription;
	}
	
	/**
	 * @return the iconUrl
	 */
	public String getIconUrl() {
		return mIconUrl;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return mName;
	}
	
	public static MediumType getInstance(String name) {
		return (MediumType)sMap.get(name);
	}
}